<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"><!-- InstanceBegin template="/Templates/general.dwt" codeOutsideHTMLIsLocked="false" -->
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <!-- InstanceBeginEditable name="doctitle" -->
        <title>SATK - Nuevo Torneo</title>
        <!-- InstanceEndEditable -->
        <link href="/satk/resources/css/theme/jquery-ui-1.8.11.custom.css" rel="stylesheet" type="text/css" />
        <link href="/satk/resources/css/vanadium.css" rel="stylesheet" type="text/css" />
        <link href="/satk/resources/css/global.css" rel="stylesheet" type="text/css" />
        <script src="/satk/resources/js/jquery-1.5.1.min.js" type="text/javascript" ></script>
        <script src="/satk/resources/js/jquery-ui-1.8.12.custom.min.js" type="text/javascript" ></script>
        <script src="/satk/resources/js/vanadium-min.js" type="text/javascript" ></script>
        <script src="/satk/resources/js/jquery-general-SATK.js" type="text/javascript" ></script>
        <!-- InstanceBeginEditable name="head" -->
        <script type="text/javascript" >
            var ctrlNuevoTorneo = {
                init: function(){
                    ctrlNuevoTorneo.inputs.fInicio = $(".-cFInicio");
                    ctrlNuevoTorneo.inputs.fTermino= $(".-cFTermino");
                    ctrlNuevoTorneo.inputs.fCierreInsc= $(".-cFCierreInsc");
                    
                    $(".-cFInicio, .-cFTermino, -cFCierreInsc").datepicker({
                        changeMonth: true, showOtherMonths:true, numberOfMonths: 3, showOn: "button", buttonImage: SATK.Bases.iconCalendar()
                    });
                }
            };
            ctrlNuevoTorneo.inputs = { fInicio: null, fTermino: null, fCierreInsc: null };
            
            jQuery(function(){  
                ctrlNuevoTorneo.init();
                ctrlNuevoTorneo.inputs.fInicio.datepicker({
                    onSelect: function(selectedDate){
                        var instance = $( this ).data( "datepicker" );
                        var date = $.datepicker.parseDate(
                            instance.settings.dateFormat || $.datepicker._defaults.dateFormat,
                            selectedDate, instance.settings );
                        ctrlNuevoTorneo.inputs.fTermino.datepicker("option","minDate", date);
                        ctrlNuevoTorneo.inputs.fCierreInsc.datepicker("option","maxDate", date);
                    }
                });
            });
        </script>
        <!-- InstanceEndEditable -->
    </h:head>

    <h:body>
        <div class="body-div">
            <ui:include src="/Templates/theme/headTheme.xhtml" />
            <div class="body-warp ui-content ui-widget ui-widget-content ui-corner-all">
                <div id="body-left" class="ui-corner-left">
                    <!-- InstanceBeginEditable name="body-left" -->
                    <!-- InstanceEndEditable -->
                </div>
                <div id="body-right">
                    <!-- InstanceBeginEditable name="body-contenido" -->
                    <div class="ui-content ui-widget ui-widget-content ui-corner-all" >
                        <div class="ui-content-body ui-widget-content">
                            <h:form id="ctrlTorneos" styleClass="ui-form">
                                <fieldset >
                                    <legend>Nuevo Torneo</legend>
                                    <h:panelGroup layout="block" styleClass="ui-widget" rendered="#{adminEventosBean.result}">
                                        <div class="ui-corner-all #{adminEventosBean.stateResult}" style="padding: 0 .7em;">
                                            <p>
                                                <span class="ui-icon #{adminEventosBean.iconResult}" style="float: left; margin-left: .3em;" />
                                                <strong><h:outputText value="#{adminEventosBean.resultCode}" /></strong> -
                                                <h:outputText value="#{adminEventosBean.resultMessage}" />
                                                <br/>
                                                <c:set value="#{adminEventosBean.newEvento.identificador}" var="identificadorEvento" />
                                                <h:commandLink value="Ver #{adminEventosBean.newEvento.nombre}" action="#{eventoActivo.cambiarTorneo(identificadorEvento)}" />
                                            </p>
                                        </div>
                                    </h:panelGroup>

                                    <p>
                                        <h:outputLabel for="nombre">Nombre: </h:outputLabel>
                                        <h:inputText id="nombre" value="#{adminEventosBean.newEvento.nombre}"
                                                     required="${true}" maxlength="45" /> 
                                    </p>
                                    <h:message for="nombre" styleClass="validator-messages" />
                                    <p>
                                        <h:outputLabel for="lugar">Lugar: </h:outputLabel>
                                        <h:inputText id="lugar" value="#{adminEventosBean.newEvento.lugar}"
                                                     maxlength="45" required="${true}"/>
                                    </p>
                                    <h:message for="lugar" styleClass="validator-messages" />
                                    <p>
                                        <h:outputLabel for="fInicio" title="Fecha de Inicio">
                                            F. Inicio: </h:outputLabel>
                                        <h:inputText id="fInicio" value="#{adminEventosBean.newEvento.fechaInicio}"
                                                     required="${true}" styleClass="-cFInicio">
                                            <f:convertDateTime pattern="dd/MM/yyyy"  />
                                        </h:inputText>
                                    </p>
                                    <p>
                                        <h:outputLabel for="fTermino" title="Fecha de Termino">
                                            F. Termino: </h:outputLabel>
                                        <h:inputText id="fTermino" value="#{adminEventosBean.newEvento.fechaTermino}"
                                                     required="${true}" styleClass="-cFTermino">
                                            <f:convertDateTime pattern="dd/MM/yyyy"  />
                                        </h:inputText>
                                    </p>
                                    <p>
                                        <h:outputLabel for="fCierre" title="Fecha de cierre de inscripciones">
                                            F. Cierre de Inscripciones: </h:outputLabel>
                                        <h:inputText id="fCierre" value="#{adminEventosBean.newEvento.fechaCierreInscripciones}"
                                                     required="${true}" styleClass="-cFCierreInsc">
                                            <f:convertDateTime pattern="dd/MM/yyyy"  />
                                        </h:inputText>
                                    </p>
                                    <p class="ui-form-command">
                                        <h:commandButton id="guardar" value="Crear"
                                                         actionListener="#{adminEventosBean.add(adminEventosBean.newEvento)}" />
                                        <h:commandButton id="limpiar" value="Limpiar" type="reset" />
                                    </p>

                                </fieldset>
                            </h:form>
                        </div>
                    </div>
                    <!-- InstanceEndEditable -->
                </div>
            </div> <!-- END class="body-content" -->
            <ui:include src="/Templates/theme/footerTheme.xhtml" />
        </div>
    </h:body>
<!-- InstanceEnd --></html>
